#pragma once
#include "Pattern\Observer.h"
//#include "File\RecordInfo.h"
#include "File\Record.h"
#include "File\PortRecord.h"






class CFileDBShadow :
	public Observer
{
private:
	CFileDBShadow();
	~CFileDBShadow();

	FILE* pLogFile;


public :
	static CFileDBShadow* GetInstance();


	bool   DeleteRecord(CRecord* );
    
	void   InstantiateRecordFormDB();

	bool   InsertRecord(CRecord* );


	bool   InsertSpanRecord(CRecord*);

	CRecord* GetPrevRecord(CRecord* pCurrRecord);
	CRecord* GetNextRecord(CRecord* pCurrRecord);

	ULONGLONG  QueryRecordSizeInSpan(CRecord* );
	ULONGLONG  QueryRecordSizeInSpan(CTime& begin, CTime& end, UINT owner, char* tab);

	bool   UpdateRecordStatus(CRecord*, RECORD_STATUS status);
    void   UpdatePortRecordStatus(CPortRecord* pPortRecord);


	virtual void Update(UINT msg , WPARAM wParam, LPARAM lParam);

	void  Reborn();
};

